package routers

import (
	"github.com/gin-gonic/gin"
	"user_api/api"
	"user_api/middlewares"
)

func InitUserRouter(Router *gin.RouterGroup) {
	{
		Router.GET("/users/", func(context *gin.Context) {
			context.String(200, "get userinfos")
		})

		//添加用户
		Router.POST("/AddUser/", api.AddUser)
		//根据uiser_id获取用户信息
		Router.POST("/getUserInfo/", middlewares.JWTAuth(), api.GetUserInfo)
		//根据账号获取用户信息
		Router.POST("/getUserInfoByAcount/", middlewares.JWTAuth(), api.GetUserInfoByAcount)
		//根据姓名获取用户信息
		Router.POST("/getUserInfoByName/", middlewares.JWTAuth(), api.GetUserInfoByName)
		//根据手机号获取用户信息
		Router.POST("/getUserInfoByMobile/", middlewares.JWTAuth(), api.GetUserInfoByMobile)
		//删除用户
		Router.POST("/delUser/", middlewares.JWTAuth(), api.DelUser)
		//添加用户
		Router.POST("/editUser/", middlewares.JWTAuth(), api.EditUser)
		//获取用户列表
		Router.POST("/getUserList/", middlewares.JWTAuth(), api.GetUserList)

	}
}

func InitRoleRouter(Router *gin.RouterGroup) {
	{
		//添加角色
		Router.POST("/addRole/", middlewares.JWTAuth(), api.AddRole)
		//编辑角色
		Router.POST("/editRole/", middlewares.JWTAuth(), api.EditRole)
		//删除角色
		Router.POST("/delRole/", middlewares.JWTAuth(), api.DelRole)

		//根据角色ID查询角色信息
		Router.POST("/getRoleInfoByRoleId/", middlewares.JWTAuth(), api.GetRoleInfoByRoleId)

		//获取角色列表
		Router.POST("/getRoleList/", middlewares.JWTAuth(), api.GetRoleList)
	}

}
